/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Generation.Production.impl;

import EA_Model.IEC61970.Generation.Production.HydroEnergyConversionKind;
import EA_Model.IEC61970.Generation.Production.HydroGeneratingUnit;
import EA_Model.IEC61970.Generation.Production.ProductionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Hydro Generating Unit</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.HydroGeneratingUnitImpl#getEnergyConversionCapability <em>Energy Conversion Capability</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.HydroGeneratingUnitImpl#getHydroUnitWaterCost <em>Hydro Unit Water Cost</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class HydroGeneratingUnitImpl extends GeneratingUnitImpl implements HydroGeneratingUnit {
	/**
	 * The default value of the '{@link #getEnergyConversionCapability() <em>Energy Conversion Capability</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnergyConversionCapability()
	 * @generated
	 * @ordered
	 */
	protected static final HydroEnergyConversionKind ENERGY_CONVERSION_CAPABILITY_EDEFAULT = HydroEnergyConversionKind.GENERATOR;

	/**
	 * The cached value of the '{@link #getEnergyConversionCapability() <em>Energy Conversion Capability</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnergyConversionCapability()
	 * @generated
	 * @ordered
	 */
	protected HydroEnergyConversionKind energyConversionCapability = ENERGY_CONVERSION_CAPABILITY_EDEFAULT;

	/**
	 * The cached value of the '{@link #getHydroUnitWaterCost() <em>Hydro Unit Water Cost</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHydroUnitWaterCost()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float hydroUnitWaterCost;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected HydroGeneratingUnitImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductionPackage.Literals.HYDRO_GENERATING_UNIT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public HydroEnergyConversionKind getEnergyConversionCapability() {
		return energyConversionCapability;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnergyConversionCapability(HydroEnergyConversionKind newEnergyConversionCapability) {
		HydroEnergyConversionKind oldEnergyConversionCapability = energyConversionCapability;
		energyConversionCapability = newEnergyConversionCapability == null ? ENERGY_CONVERSION_CAPABILITY_EDEFAULT : newEnergyConversionCapability;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.HYDRO_GENERATING_UNIT__ENERGY_CONVERSION_CAPABILITY, oldEnergyConversionCapability, energyConversionCapability));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getHydroUnitWaterCost() {
		if (hydroUnitWaterCost != null && hydroUnitWaterCost.eIsProxy()) {
			InternalEObject oldHydroUnitWaterCost = (InternalEObject)hydroUnitWaterCost;
			hydroUnitWaterCost = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldHydroUnitWaterCost);
			if (hydroUnitWaterCost != oldHydroUnitWaterCost) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST, oldHydroUnitWaterCost, hydroUnitWaterCost));
			}
		}
		return hydroUnitWaterCost;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetHydroUnitWaterCost() {
		return hydroUnitWaterCost;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHydroUnitWaterCost(EA_Model.IEC61970.Domain.Float newHydroUnitWaterCost) {
		EA_Model.IEC61970.Domain.Float oldHydroUnitWaterCost = hydroUnitWaterCost;
		hydroUnitWaterCost = newHydroUnitWaterCost;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST, oldHydroUnitWaterCost, hydroUnitWaterCost));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductionPackage.HYDRO_GENERATING_UNIT__ENERGY_CONVERSION_CAPABILITY:
				return getEnergyConversionCapability();
			case ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST:
				if (resolve) return getHydroUnitWaterCost();
				return basicGetHydroUnitWaterCost();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductionPackage.HYDRO_GENERATING_UNIT__ENERGY_CONVERSION_CAPABILITY:
				setEnergyConversionCapability((HydroEnergyConversionKind)newValue);
				return;
			case ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST:
				setHydroUnitWaterCost((EA_Model.IEC61970.Domain.Float)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductionPackage.HYDRO_GENERATING_UNIT__ENERGY_CONVERSION_CAPABILITY:
				setEnergyConversionCapability(ENERGY_CONVERSION_CAPABILITY_EDEFAULT);
				return;
			case ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST:
				setHydroUnitWaterCost((EA_Model.IEC61970.Domain.Float)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductionPackage.HYDRO_GENERATING_UNIT__ENERGY_CONVERSION_CAPABILITY:
				return energyConversionCapability != ENERGY_CONVERSION_CAPABILITY_EDEFAULT;
			case ProductionPackage.HYDRO_GENERATING_UNIT__HYDRO_UNIT_WATER_COST:
				return hydroUnitWaterCost != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (energyConversionCapability: ");
		result.append(energyConversionCapability);
		result.append(')');
		return result.toString();
	}

} //HydroGeneratingUnitImpl
